﻿#ifndef ORVSETTINGS_H
#define ORVSETTINGS_H

#include <QFrame>
#include <QtSql>

namespace Ui {
class orvSettings;
}

class orvSettings : public QFrame
{
    Q_OBJECT
    
public:
    explicit orvSettings(QWidget *parent = 0);
    ~orvSettings();
    QString getHost(){return dbHost;}
    QString getName(){return dbName;}
    QString getUser(){return dbUser;}
    QString getPassword(){return dbPassword;}

signals:
    void settingsChanged();

private slots:
    void on_okButton_clicked();
    void on_cancelButton_clicked();

    void on_addButton_clicked();

    void on_delButton_clicked();

private:
    Ui::orvSettings *ui;
    QString dbHost,dbName,dbUser,dbPassword;
    QSqlTableModel *model;
    QSqlDatabase db;
    void createConnection();
    void readIni();
    void writeIni();
    void setStrings();
    void getStrings();

};

#endif // ORVSETTINGS_H
